home *** CD-ROM | disk | FTP | other *** search
-
- Modules
-
-
- • Implementation modules
-
-
- An implementation module consists of a sequence of type, function, graph
-
- and macro definitions. These definitions have in principle only a local
-
- scope: they only have meaning in the implementation module they are
-
- defined in. In the corresponding definition module one can specify which
-
- types and rules (defined in the corresponding implementation module) are
-
- exported, i.e. are made visible to the outside world.
-
-
-
-
- • The main module
-
-
- The main module is always an implementation module. In its module header
-
- the keyword "implementation" can be left out. In that case the main
-
- module does not need a corresponding definition module. Furthermore, a
-
- main module should always contain an explicit or implicit declaration of
-
- the Start rule, i.e. this rule should either be defined in the start module or
-
- imported from another module. Any implementation module can become a
-
- main module by inserting a start rule. This is helpful for the debugging of
-
- modules.
-
-
-
-
- • Definition modules
-
-
- In a definition module one can specify which definitions (defined in the
-
- corresponding implementation module) are exported, i.e. are made visible
-
- to the outside world. To export a type or a function from an
-
- implementation module one has to define their type definition in the
-
- corresponding definition module. To export a macro the macro definition
-
- from the implementation module has to be defined in the corresponding
-
- definition module. All other definitions given in the implementation module
-
- remain hidden.
-
-
-
-
- • System modules
-
-
- System modules are special definition modules indicated by the keyword
-
- "system" instead of "definition". This indicates that the corresponding
-
- implementation module does not contain ordinary Clean rules, but abstract
-
- (P)ABC-machine code instead. This facility makes it possible to program
-
- directly in (P)ABC-code. This can be used to increase execution speed of
-
- heavily used functions or complex data structures. At demand, the Clean
-
- compiler will substitute the ABC code of a function in-line at the place in
-
- which the corresponding function is called. In this way execution speed is
-
- increased even more.
-
-
-
- System modules have as advantage that a certain increase of efficiency
-
- can be obtained on a device independent manner, since (P)ABC-code is
-
- device independent. It goes without saying that for (P)ABC programming
-
- advanced knowledge is needed of the code generation schemes and the
-
- run-time behaviour of the (P)ABC-machine. Imprudent programming of
-
- system modules will generally lead to unpredictable errors. Typically, the
-
- predefined arithmetic Std rules are implemented as system modules.
-
-
-